package com.momento.tibco.courselearn;

import android.util.Log;

/**
 * Created by xiaoyu on 2016/1/28.
 */
public class Logger {
    public static final String MODE_DEBUG = "debug";
    public static final String MODE_RELEASE = "release";
    private static boolean mIsDebug = false;
    private static String mTag;

    private Logger() {
    }

    public static void setTag(String tag) {
        mTag = tag;
    }

    public static void setDebugMode(String debugMode) {
        if (debugMode.equals(MODE_DEBUG)) {
            mIsDebug = true;
        } else {
            mIsDebug = false;
        }
    }

    public static void log(String str) {
        if (mIsDebug) {
            if (null == mTag) {
                mTag = "info";
            }
            Log.d(mTag, str);
        }
    }

    public static void error(String str){
        if (mIsDebug) {
            if (null == mTag) {
                mTag = "info";
            }
            Log.e(mTag, str);
        }
    }
    public static boolean isDebug(){
        return mIsDebug;
    }
}
